package main

import (
	"fmt"
	"math/rand"
	"time"
)

func main() {
	// 打印 A-Z
	var arr [26]byte
	var j byte = 'A'
	for i := 0; i < len(arr); i++ {
		arr[i] = j
		j++
	}
	for i := 0; i < len(arr); i++ {
		fmt.Printf("%c ", arr[i])
	}
	fmt.Println()

	// 求数组的最大值
	var array [12]int

	rand.Seed(time.Now().UnixNano())
	for i := 0; i < len(array); i++ {
		array[i] = rand.Intn(100) + 1
		fmt.Printf("%d ", array[i])
	}
	fmt.Println()

	var max int = 0
	var sum int = 0
	for i := 0; i < len(array); i++ {
		if array[i] > max {
			max = array[i]
		}
		sum += array[i]

	}
	fmt.Println("arr max is ", max)
	fmt.Println("arr sum is ", sum)
	fmt.Printf("arr average is %.3f\n", float64(sum)/float64(len(array)))

	// reverse
	fmt.Println("reverse is :")
	for i := len(array) - 1; i >= 0; i-- {
		fmt.Print(array[i], " ")
	}
	fmt.Println()

}
